<?php

class Core_Logs
{
	const DIR = '/var/applog/';
	
	public static function log( $system = 'global', $name = 'global', $msg = '', $level = 'INFO' ) {
		
		if( !is_dir( self::DIR . $system ) ) {
			mkdir( self::DIR . $system );
			chmod( self::DIR . $system, 0777 );
		}
		
		$logFile = self::DIR . $system . '/' . $name . '_' . Date( 'Y-m-d' ) . '.log';
		$writer  = new Zend_Log_Writer_Stream( $logFile );
		$logger  = new Zend_Log( $writer );
		
		switch( $level ) {
			case 'INFO' : 
				$logger->info( $msg );
				break;
				
			case 'ERROR' :
				$logger->err( $msg );
				break;
		}
	}
	
}
